package com.thd.example.service;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.thd.example.entity.ThdFramesetExampleEntity;
import com.thd.example.entity.ThdFramesetExampleVO;
import com.thd.example.mapper.ThdFramesetExampleMapper;
import com.thd.framework.basic.utils.StringUtils;
import com.thd.framework.db.mapper.BasicMpMapper;
import com.thd.framework.db.service.BasicMpServiceImpl;
import com.thd.framework.db.utils.PageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.util.List;
@Component("thdFramesetExampleService")
public class ThdFramesetExampleServiceImpl extends BasicMpServiceImpl<ThdFramesetExampleMapper, ThdFramesetExampleEntity>  implements ThdFramesetExampleService{
    @Autowired
    private ThdFramesetExampleMapper thdFramesetExampleMapper;
    @Override
    public BasicMpMapper<ThdFramesetExampleEntity> getMapper() {
        return thdFramesetExampleMapper;
    }


    @Override
    public ThdFramesetExampleEntity createThdFramesetExample(ThdFramesetExampleEntity thdFramesetExampleEntity) {
        this.save(thdFramesetExampleEntity);
        return thdFramesetExampleEntity;
    }

    @Override
    public ThdFramesetExampleEntity modifyThdFramesetExample(ThdFramesetExampleEntity thdFramesetExampleEntity) {
        this.updateById(thdFramesetExampleEntity);
        return thdFramesetExampleEntity;
    }
    @Override
    public ThdFramesetExampleEntity saveOrUpdateThdFramesetExample(ThdFramesetExampleEntity thdFramesetExampleEntity){
        this.saveOrUpdate(thdFramesetExampleEntity);
        return thdFramesetExampleEntity;
    };

    @Override
    public ThdFramesetExampleEntity queryThdFramesetExampleById(Serializable id) {
        return this.getById(id);
    }

    @Override
    public void deleteThdFramesetExampleById(Serializable id) {
        this.removeById(id);
    }

    @Override
    public List<ThdFramesetExampleVO> queryThdFramesetExample(ThdFramesetExampleVO thdFramesetExampleEntitVo) {
        return this.thdFramesetExampleMapper.queryList(thdFramesetExampleEntitVo);
    }

    @Override
    public PageInfo<ThdFramesetExampleVO> queryThdFramesetExamplePage(ThdFramesetExampleVO thdFramesetExampleEntitVo) {
//        PageHelper.startPage(thdFramesetExampleEntitVo.getPageNum(), thdFramesetExampleEntitVo.getPageSize()).setOrderBy("create_time desc");
//        PageHelper.orderBy(" id asc ");

        PageUtils.setPageHelper(thdFramesetExampleEntitVo);
        PageInfo<ThdFramesetExampleVO> result = new PageInfo<ThdFramesetExampleVO>(this.thdFramesetExampleMapper.queryList(thdFramesetExampleEntitVo));
        return result;
    }
    public IPage<ThdFramesetExampleVO> pageJoinQuery(IPage<ThdFramesetExampleVO> page, ThdFramesetExampleVO thdFramesetExampleEntitVo){
        return this.thdFramesetExampleMapper.queryList(page,thdFramesetExampleEntitVo);
    };

}
